<div class="container ">
<div class="span-17 main-content">
 	<h2 class="group_title"><%= link_to 'Grupe', groups_path%> - <%= @group.name %></h2>
 	
 	<% if @group.permission_id < 5 %>
		<div class="private_group">
			<%= image_tag('black_icons/key.png', :class => :menu_icon)%>
			Uz tebe, ovu grupu mogu čitati samo članovi s razinom dopuštenja <b>"<%= @group.permission.name %>"</b> ili većom.
		</div>
	<% end %>

	<% if @group.description.length > 0 %>
		<div class="group_description">
			<%= raw @group.description %> 
		</div>
	<% end %>
	
  <% if @threads.empty? %>
    <b> Nema otvorenih tema :( </b> 
  <% else %>
		<% if logged? %>
			<div style="margin-top:20px;"><%= link_to 'Označi sve kao pročitane', mark_all_as_visited_url%></div>
		<% end %>

  <table id="groups_threads">
    <tr> 
      <th class="groups_threads groups_threads_icon"></th> 
      <th class="groups_threads">Naslov</th> <th class="groups_threads">Broj poruka</th> <th class="groups_threads">Zadnji doprinos</th>
    </tr>
		  
	  <% @threads.each do |thread|%>
	    <%= render :partial => 'thread_row', :locals => {:thread => thread} %>
	  <% end %>
	  
  </table>
  <% end %>
  
    <% if current_member %>
    <div class="admin_links">
      		<%= link_to 'Stvori temu', new_groups_thread_id_path(@group.id) %>
    </div>
  	<% end %>
  
  	<% if moderator? %>
	 	<div class='admin_links'>
	 		<%= link_to 'Uredi grupu', edit_group_path(@group) %>
	 		<%= link_to 'Dodaj clanove u gurpu', add_members_to_group_path(@group) %>
	 		<%= link_to 'Izbrisi grupu', @group, :confirm => 'Are you sure?', :method => :delete %>

	 	</div> 
 	<% end %>
 	<div style="clear:both;"></div>
 	  <div class="group_description">
    <% if @group.members.length > 0 %>
        <b>Tko prati grupu?</b>
        <%= render 'members_in_group'%>
      <% else %>
        Nitko ne prati grupu :(
      <% end %>
        <br>      
      <% if logged? %>
        <% if current_member.is_in_group?(@group.id)%>
            <%= link_to "Napusti grupu", leave_group_path(@group_id)%>
        <% else %>
            <%= link_to "Pridruži se", join_group_path(@group_id) %>
        <% end %>
    <% end %>
  </div>
</div>
<%= render 'shared/sidebar'%>

</div> 
  
  

